#! /bin/python3

"""这个脚本用于切分数据

Keyword arguments:
没有，直接修改下方参数即可
Return: 无
"""

raw_data_path = "../materials/data.txt"
blank_unbeded_json_path = "../materials/blank_unembeded1.json"
splitor = "*****"

def main():
    import json
    rd = ""
    with open(raw_data_path,"r",encoding='utf-8') as r:
        for line in r :
            rd += line
    r.close()
    rds = rd.split(splitor)
    print(rds)
    jobj = []
    cnd = 0
    for sec in rds :
        add_item = {}
        add_item["content"] = sec.strip()
        add_item["id"] = cnd
        add_item["tags"] = None
        add_item["short"] = None
        cnd += 1
        jobj.append(add_item)
    print('')
    print(jobj)
    with open(blank_unbeded_json_path,"w") as w:
        json.dump(jobj,w,ensure_ascii=False)
    w.close()

main()